package com.caishi.lkx.exam.service;

import com.caishi.lkx.common.ienum.ClientType;
import com.caishi.lkx.exam.model.ColumnModel;
import com.zzw.common.entity.BaseService;
import com.zzw.common.exception.BizException;
import com.zzw.common.service.NameService;
import com.zzw.common.service.service.SortService;

import com.caishi.lkx.exam.ienum.type.ColumnType;

import com.caishi.lkx.order.CommonAssetsService;

import java.util.List;

/**
 *
 */
public interface IColumnService extends BaseService<ColumnModel, String>, NameService<ColumnModel, String>, SortService<ColumnModel>, CommonAssetsService<ColumnModel, String> {
    /**
     * 获取栏目名称
     *
     * @param columnIds
     * @return
     */
    String queryNames(List<String> columnIds);

    /**
     * 获取科目下的栏目
     *
     * @param categoryId
     * @return
     */
    List<ColumnModel> queryCategoryColumns(Long categoryId);

    /**
     * 查询科目下某种类型栏目的ids
     *
     * @param categoryId
     * @param columnType
     * @return
     */
    List<String> categoryColumn(Long categoryId, ColumnType columnType);

    /**
     * 科目更新时设置栏目
     *
     * @param categoryId
     * @param data
     */
    void categoryUpdateColumn(Long categoryId, List<ColumnModel> data);


    /**
     * 获取栏目下配置的试题ids
     *
     * @param columnIds
     * @param columnType
     * @return
     */
    List<String> fetchQuestionIds(List<String> columnIds, ColumnType columnType);

    Integer fetchQuestionSize(List<String> columnIds, ColumnType columnType);

    /**
     * 查询栏目下关联的集合ids
     *
     * @param columnId
     * @return
     */
    List<String> columnRelationCollectionIds(String columnId);

    List<String> columnRelationCollectionIds(List<String> columnId);


    /**
     * 判断当前请求是否有栏目权限
     *
     * @param userGroupId  用户的机构id
     * @param localGroupId 当前位置机构id
     * @param userId       用户id
     * @param categoryId   科目id
     * @param columnId     栏目id
     * @return
     */
    boolean currentHaveAuth(Long userGroupId, Long localGroupId, String userId, Long categoryId, String columnId, ClientType clientType) throws BizException;

    /**
     * 根据科目id获取 更多试卷 栏目 不存在就创建一个新的栏目默认在前台展示
     * @param categoryId 科目id
     * @return
     */
    ColumnModel morePaperByCategory(Long categoryId);
}
